//
//  HomeViewController.swift
//  FootballDataRecord
//
//  Created by Xx Jiang on 2020/1/6.
//  Copyright © 2020 Xx Jiang. All rights reserved.
//

import UIKit

class HomeViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    override func viewWillAppear(_ animated: Bool) {
        self.navigationController?.navigationBar.isHidden = true
    }
    override func viewWillDisappear(_ animated: Bool) {
        self.navigationController?.navigationBar.isHidden = false
        
    }
    @IBAction func goToCreate(_ sender: Any) {
        
        
        let model = MatchModel()
        let dateModel = DateModel()
        dateModel.now()
        model.matchId = "\(dateModel.year)-\(dateModel.month)-\(dateModel.day) \(dateModel.hour):\(dateModel.minute):\(dateModel.second)"
        DHDataBaseOperate.insertModelToDB(model: model) { (rs) in
            if rs.isEqual(1) {
                let vc = CreateGameViewController()
                vc.matchModel = model;
                self.navigationController?.pushViewController(vc, animated: true)
            }
        }
    }
    
    @IBAction func gotoHistoryGame(_ sender: Any) {
        let vc = HistoryViewController()
        self.navigationController?.pushViewController(vc, animated: true)
    }
    
}
